<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
	<meta name="baidu-site-verification" content="JdMif0g2tL" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>angular</title>
</head>
<body ng-app="myApp">
<style type="text/css" media="screen">
	*{
		outline: none;
	}
</style>
<div ng-controller="appCtrl">
	<input type="text" ng-model="abc">
	<p ickt-show="abc">查看p元素是否显隐</p>
</div>

<script type="text/javascript">
	document.getElementsByTagName('html')[0].style.fontSize=window.screen.width/10+'px';
</script>
<script src="../js/angular.min.js" charset="utf-8"></script>
<script type="text/javascript">
var app =angular.module('myApp', []);
app.controller('appCtrl', ['$scope', function($scope){
	$scope.abc='false';
}]);
app.directive('icktShow', function(){
	// Runs during compile
	return {
		restrict: 'A', 
		compile:function(){
			// console.log(this,111);
			// console.log(arguments,222);
			//返回值就是link函数
			return function(scope,jqlite,attrs){
				//监听ickt-show
				scope.$watch(attrs.icktShow, function(newValue) {
					console.log(newValue);
					if(newValue){
						jqlite.css("display","block");
					}else{
						jqlite.css("display","none");
					}
				});
			}
		}
	};
});
</script>
</body>
</html>
<!--应该是13.8，时间-2017-05-07->